16. Running Mad Libs

Running Mad Libs

Run the Code Yourself

Now that we have a working version of the Mad Libs generator, let's run it and see it in action! Once you've downloaded madlibs_generator.py from the previous section, open up your command line interface (Terminal if you're on a Mac or Linux machine, Git Bash if you're on Windows).

Note: The file may not immediately download and instead open in a new browser tab. If so, you can copy and paste the code into a new file in your text editor and name it madlibs_generator.py. Save it somewhere easy to access like your Desktop.

First cd to the directory where you've saved madlibs_generator.py. If you just downloaded the file and didn't move it elsewhere, it's probably in Downloads or Desktop.

Now enter the command python madlibs_generator.py (if you're using Git Bash on Windows, enter the command winpty python madlibs_generator.py). The quiz should start running and you can input your answers straight into the command line!